<template>
  <!-- Vue3组件中的模板结构没有根标签 -->
  <h1>一个人的信息</h1>
  <h2>姓名：{{name}}</h2>
  <h2>年龄:{{age}}</h2>
  <h3>职位:{{job.type}}</h3>
  <h3>工资:{{job.salary}}</h3>
  <button @click="changeInfo">修改人的信息</button>
</template>

<script>
  // import {h} from 'vue'
  import { ref } from 'vue'
  export default {
    name: 'App',
    setup() {
      let name  = ref('张三')  //引用对象
      let age = ref(18)       //引用对象
      let job = ref({
        type:"前端",
        salary:'7K'
      })
      
      function changeInfo(){
        name.value = '李四',
        age.value = '48'
        job.value.type = '后端',
        job.value.salary = '8.5K'
        console.log(name,age,job.value);
      }
       //返回一个对象(常用)
      return {
        name,
        age,
        job,
        changeInfo
      }
    }
  }
</script>

<style>
  #app {
    font-family: Avenir, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-align: center;
    color: #2c3e50;
    margin-top: 60px;
  }
</style>
